package com.example.lifeData;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.SavedStateViewModelFactory;
import androidx.lifecycle.ViewModelProvider;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;

import com.example.lifeData.databinding.ActivityMainBinding;

public class MainActivity extends AppCompatActivity {
    ViewModelWithLiveData viewModelWithLiveData;
    public final static  String KEY_NUMBER = "my_number";

     ActivityMainBinding binding;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        binding = DataBindingUtil.setContentView(this,R.layout.activity_main);
        viewModelWithLiveData = new ViewModelProvider(this, new SavedStateViewModelFactory(getApplication(),this)).get(ViewModelWithLiveData.class);
        binding.setData(viewModelWithLiveData);
        binding.setLifecycleOwner(this);


    }
}